#-*- coding: utf-8 -*-

"""
Django local settings for the hyperkitty project.
"""

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = ()
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'hyperkitty',
        'USER': 'hyperkitty',
        'PASSWORD': '{{ lists_dev_hk_db_pass }}',
        'HOST': 'localhost',
        'PORT': '',
    }
}
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/hyperkitty/static/'

# Add Fedora to the authentication backends
AUTHENTICATION_BACKENDS = (
    'social_auth.backends.browserid.BrowserIDBackend',
    'hyperkitty.lib.fedora.FedoraBackend',
    'social_auth.backends.google.GoogleBackend',
    'social_auth.backends.yahoo.YahooBackend',
    #'social_auth.backends.OpenIDBackend',
    'django.contrib.auth.backends.ModelBackend',
)

# Use the email address as the username (add associate_by_email).
SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.associate.associate_by_email',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details'
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'file':{
            'level': 'DEBUG',
            #'class': 'logging.handlers.RotatingFileHandler',
            'class': 'logging.FileHandler',
            'filename': '/var/log/hyperkitty/hyperkitty.log',
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['file'],
            'level': 'ERROR',
            'propagate': True,
        },
        'django': {
            'handlers': ['file'],
            'level': 'ERROR',
            'propagate': True,
        },
        'hyperkitty': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
}

APP_NAME = 'Fedora list archives'
KITTYSTORE_URL = 'postgres://kittystore:{{ lists_dev_ks_db_pass }}@localhost/kittystore'
USE_MOCKUPS = False
